package com.cjl.demo.data.structure;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * <p>Description: </p>
 *
 * @ uthor chenjinliang
 * @ date: 2020/9/7
 */
public class StaticClassDome {


    public static void main(String[] args) {
        System.out.println(", Y = " + ClassB.Y  );
        System.out.println(", X = " + ClassA.X  );
        List<String>  wordList = Arrays.asList("hello word!", "hello time");
        List<String> wordMapList = wordList.stream()
                .map(s-> s.split(" "))
                .flatMap(Arrays::stream).collect(Collectors.toList());
        System.out.println("wordMapList = [" + wordMapList.toString() + "]");
//        try {
//            Thread.sleep(1000);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
//        System.out.println(", Y = " + ClassB.Y + ", X = " + ClassA.X   );
    }


}

class ClassA {

    public static int Z = 1242;

    public static int X = ClassB.getY(Z) + 1;

}

class ClassB{
    public static int Y ;

    static {
        init();
    }

    public static void init(){
        Y = ClassA.Z + 1;
        System.out.println("****ClassB.Y = " + Y);
        try {
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public static int getY(int Z){
        return Y;
    }

}